This repository was archived by the owner on Oct 13, 2023. It is now read-only.
feat(rest): Implement evmos and cometbft all rest interfaces for us to query information about the chain#180
Open
luchenqun wants to merge 4 commits intoevmos:mainfrom
Open
feat(rest): Implement evmos and cometbft all rest interfaces for us to query information about the chain#180luchenqun wants to merge 4 commits intoevmos:mainfrom
luchenqun wants to merge 4 commits intoevmos:mainfrom
Conversation
…o query information about the chain
Author
|
@GAtom22 Please do a review. If you think the implementation is reasonable, I will continue to improve the function |
Contributor
|
Hey @luchenqun thanks for the contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
evmos and cometbft provide many interfaces for us to query information about the chain. However, unfortunately, evmosjs does not implement these interfaces in the provider package. In actual business scenarios, when these interfaces are needed, they are individually encapsulated. To solve the above problem, the
packages/provider/src/rest/cometbft.tsfile in evmosjs implements the related request interfaces of cometbft, and thepackages/provider/src/rest/app.tsfile implements the related request interfaces of evmos.To be able to use both in Node.js and browsers, axios is used as the underlying network library.
Usage and Examples
Below is a simple code example that demonstrates how to use the provider package in evmosjs to query information about the evmos chain.
If the returned data is correct, you can directly retrieve the values from the returned
Object. For example, if the data returned bybank.allBalancesis as follows:If the returned data is an error, the evmos declares the error data as follows:
Cometbft declares the error data as follows: